const app = getApp()

Page({
    data: {
        lbimgs: [
            'https://ipass.cc/sqimages/20210402130909.jpg',
            'https://ipass.cc/sqimages/20210402130944.jpg',
            'https://ipass.cc/sqimages/20210402130932.jpg'
        ],
        navigators: [{
                icon: '../../icon/dianpu.png',
                name: '店铺',
                url: '../../indattach/dianpu/dianpu'
            },          
            {
                icon: '../../icon/hdon.png',
                name: '活动',
                url: '../../indattach/hdon/hdon'
            },
            {
                icon: '../../icon/jingqv.png',
                name: '景区',
                url: '../../indattach/jingqv/jingqv'
            },
            {
                icon: '../../icon/zhaos.png',
                name: '招商',
                url: '../../indattach/tincc/tincc'
            },
            {
                icon: '../../icon/pre_icon.png',
                name: '领取奖品',
                url: '../../indattach/getprize/getprize'
            },
            {
                icon: '../../icon/tourism.png',
                name: '抽奖',
                url: '../../indattach/acquisition/acquisition'
            },
            {
                icon: '../../icon/dj.png',
                name: '店铺登记',
                url: '../../indattach/logon/logon'
            },{
                icon: '../../icon/yy.png',
                name: '潮约拍',
                url: '../../indattach/TidalBeat/TidalBeat'
            }
            // {
            //     icon: '../../icon/yy.png',
            //     name: '抢鸭子大赛',
            //     url: '../../indattach/index/index'
            // }
        ],
        sqstorys: '',
        num:6,
        show:false
    },
    onLoad: function (options) {
        var that = this;
        wx.showLoading({
            title: '加载中...',
        })
        app.comrequest('https://ipass.cc/myapi/sqstory.php', {num:that.data.num}).then(res => {
            that.setData({
                sqstorys: res.data,
                zlenght:res.zlenght[0].zlenght
            })
            wx.hideLoading()
        })
       
    },
    
    onPullDownRefresh: function () {
        var that=this;
        that.onLoad();
        wx.stopPullDownRefresh();
    },
    onReachBottom: function () {
        var that=this;
        var zlenght=that.data.zlenght;
        var cfnum=that.data.num;
        if(cfnum>=zlenght){
            that.setData({
                num:zlenght,
                show:true
            })
        }else{
            var cfnum2=cfnum+8
            that.setData({
                num:cfnum2
            })
        }
        app.comrequest('https://ipass.cc/myapi/sqstory.php',{num:that.data.num}).then(res=>{
        that.setData({
            sqstorys:res.data
        })
        })
    },
    onShareAppMessage: function() {
      return {
        title:'上清古镇',
        path:'pages/index/index',
        success:res=>{
          console.log('成功')
        },fail:res=>{
          console.log("失败")
        }
      }
    },
    onShareTimeline:function(){
        return {
            title:'上清古镇',
            path:'pages/index/index',
            success:res=>{
              console.log('成功')
            },fail:res=>{
              console.log("失败")
            }
          }
    }
})